package com.zx.kitchen.index.common.entity;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/3/7.
 */

public class EditInfoBean implements Parcelable {
    private Map<String, DishesInfoBean> dishes_list;
    private String total_price;
    private List<CustomerListBean> customer_list;

    public Map<String, DishesInfoBean> getDishes_list() {
        return dishes_list;
    }

    public void setDishes_list(Map<String, DishesInfoBean> dishes_list) {
        this.dishes_list = dishes_list;
    }

    public void setCustomer_list(List<CustomerListBean> customer_list) {
        this.customer_list = customer_list;
    }

    public List<CustomerListBean> getCustomer_list() {
        return customer_list;
    }

    public String getTotal_price() {
        return total_price;
    }

    public void setTotal_price(String total_price) {
        this.total_price = total_price;
    }

    public static class CustomerListBean implements Parcelable {
        private String customer_name;

        public String getCustomer_name() {
            return customer_name;
        }

        public void setCustomer_name(String customer_name) {
            this.customer_name = customer_name;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.customer_name);
        }

        public CustomerListBean() {
        }

        protected CustomerListBean(Parcel in) {
            this.customer_name = in.readString();
        }

        public static final Creator<CustomerListBean> CREATOR = new Creator<CustomerListBean>() {
            @Override
            public CustomerListBean createFromParcel(Parcel source) {
                return new CustomerListBean(source);
            }

            @Override
            public CustomerListBean[] newArray(int size) {
                return new CustomerListBean[size];
            }
        };
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.dishes_list.size());
        for (Map.Entry<String, DishesInfoBean> entry : this.dishes_list.entrySet()) {
            dest.writeString(entry.getKey());
            dest.writeParcelable(entry.getValue(), flags);
        }
        dest.writeString(this.total_price);
        dest.writeList(this.customer_list);
    }

    public EditInfoBean() {
    }

    protected EditInfoBean(Parcel in) {
        int dishes_listSize = in.readInt();
        this.dishes_list = new HashMap<String, DishesInfoBean>(dishes_listSize);
        for (int i = 0; i < dishes_listSize; i++) {
            String key = in.readString();
            DishesInfoBean value = in.readParcelable(DishesInfoBean.class.getClassLoader());
            this.dishes_list.put(key, value);
        }
        this.total_price = in.readString();
        this.customer_list = new ArrayList<CustomerListBean>();
        in.readList(this.customer_list, CustomerListBean.class.getClassLoader());
    }

    public static final Parcelable.Creator<EditInfoBean> CREATOR = new Parcelable.Creator<EditInfoBean>() {
        @Override
        public EditInfoBean createFromParcel(Parcel source) {
            return new EditInfoBean(source);
        }

        @Override
        public EditInfoBean[] newArray(int size) {
            return new EditInfoBean[size];
        }
    };
}
